package com.example.lenjor.sprite.view;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;

/**
 * Created by Administrator on 2017/7/1 0001.
 */
public abstract class BaseView {
    //生命为保护变量可以被继承
    protected View view;
    protected Context context;
    public BaseView(Context context){
        this.context = context;
    }
    //定义为抽象类，子类必须重写实现这个方法
    protected abstract void initUI();

    /**
     * 绑定布局文件
     */
    protected void setContextView(int layout){
        view = LayoutInflater.from(context).inflate(layout,null);//文件转换成view对象
    }
    protected View findViewById(int id){
        return view.findViewById(id);
    }

    /**
     * 获取view对象
     * @return view
     */
    public View getView(){
        return view;
    }
}
